home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
C++
/
Applications
/
PICSee Dust 1.01
/
Quaternary Source
/
SoundUtils.h
< prev
next >
Wrap
Text File
|
1995-11-02
|
2KB
|
68 lines
#ifndef SOUNDUTILS_H_
#define SOUNDUTILS_H_
#include <Sound.h>
#ifdef __cplusplus
extern "C" {
#endif
// ---------------------------------------------------------------------------
// Define some additional rates (which aren't defined in older Sound.h files)
#define rate7khz (long)0x1CFA2E8B // 7418.1818 in fixed-point
#define rate5khz (long)0x15BBA28E // 5563.6363 in fixed-point
#define rate22050hz (long)0x56220000 // 22050.0000 in fixed-point
#define rate11050hz (long)0x2B110000 // 11025.0000 in fixed-point
// Maximum number of channels SoundUtils.c can handle
enum {
kMaxChans = 4
};
// ---------------------------------------------------------------------------
// Make sure you call this before making any other calls in SoundUtils.c
void InitSoundUtils();
// Create/dispose a sound channel. It is up to you to keep
// track of which ones you created.
// Specify 0..kMaxChans-1 in whichChan
OSErr CreateSndChannel(short whichChan);
OSErr DisposeSndChannel(short whichChan);
void PlayAsynch(Handle sndHdl, short whichChan);
void PlayAsynchBuffer(Handle sndHdl, short whichChan);
Boolean SndDone(short whichChan);
void WaitTillSndDone(short whichChan);
void SndStop(short whichChan);
void SndStopSoftly(short whichChan);
short SndGetAmplitude(short whichChan);
void SndSetAmplitude(short whichChan, short amp);
OSErr RetrieveSndHeaderOffset(Handle sndHdl, long *offset);
SoundHeader *GetSoundHeader(Handle sndHdl);
// These use a callback mechanism...
OSErr PlayAsynchCallback(Handle sndHdl, short whichChan);
OSErr PlayAsynchCallbackPriority(Handle sndHdl, short whichChan, short priority);
typedef pascal void (*SndCleanupProc)(Handle snd);
void DefaultSndCleaner(Handle snd);
void CheckSounds(short whichChan, SndCleanupProc cleaner);
// ---------------------------------------------------------------------------
// These routines take any sound channel, not just ones created
// with SoundUtils.c
void SndChanStop(SndChannelPtr chan);
Boolean SndChanDone(SndChannelPtr chan);
short SndChanGetAmplitude(SndChannelPtr chan);
void SndChanSetAmplitude(SndChannelPtr chan, short amp);
#ifdef __cplusplus
}
#endif
#endif // SOUNDUTILS_H_